import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import store from './store/index'
import { getDicts } from "@/api/system/dict/data";

import directive from './directive' // directive
Vue.use(directive)

// 字典数据组件
import DictData from '@/components/DictData'
DictData.install()

import api from '@/util/request'
Vue.prototype.$api = api

import dayjs from 'dayjs'
Vue.prototype.$dayjs = dayjs

import auth from './util/auth'
Vue.use(auth)

import cookies from 'vue-cookies'
Vue.use(cookies)

import VueMeta from 'vue-meta'
Vue.use(VueMeta)

import plugins from './plugins' // plugins
Vue.use(plugins)

// import './permission' // permission control

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/styles/resources/element-ui-reset.scss'
Vue.use(ElementUI)

import hotkeys from 'hotkeys-js'
Vue.prototype.$hotkeys = hotkeys

// 全局组件自动注册
import './components/autoRegister'

// 自动加载 svg 图标
import './assets/icons' // icon

import './assets/styles/reset.scss'

import './mock'

import { download } from '@/util/request'
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/util/lz";
import { getConfigKey } from "@/api/system/config";

// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.getConfigKey = getConfigKey


// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
// 分页组件
import Pagination from "@/components/Pagination";
// 字典标签组件
import DictTag from '@/components/DictTag'

// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)

Vue.config.productionTip = false

Vue.prototype.$eventBus = new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
